home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.06 Jun 90 / Timing Files / Timing.p < prev    next >
Encoding:
Text File  |  1989-05-26  |  680 b   |  42 lines  |  [TEXT/MPS ]

  1. UNIT Timing;
  2.  
  3. INTERFACE
  4.  
  5. {$PUSH} {$J+}
  6.  
  7. { The actual variables and code are contained in a
  8.   separate assembly language file. The assembled output
  9.   must be linked with programs using this unit }
  10.  
  11. TYPE
  12.     Timer = COMP;
  13.  
  14. CONST
  15.     MsPerClock = 1.2766E-3;
  16.  
  17. VAR
  18.     unitComp: LONGINT;    { Compensation for one call }
  19.         
  20.     totComp: COMP;        { Accumulated compensation }
  21.  
  22. {$POP}
  23.  
  24.  
  25. PROCEDURE InitTimer (VAR t: Timer);
  26.  
  27. { Initializes a timer (t := 0) }
  28.  
  29.  
  30. PROCEDURE StartTimer (VAR t: Timer);
  31.  
  32. { Starts a timer (t := t - Time + totComp;
  33.                   totComp := totComp + unitComp) }
  34.  
  35.  
  36. PROCEDURE StopTimer (VAR t: Timer);
  37.  
  38. { Stops a timer (t := t + Time - totComp;
  39.                  totComp := totComp + unitComp) }
  40.  
  41. END.
  42.